package first.niuke.huawei.mediumDifficulty;

/**
 * @ClassName HJ55
 * @description:
 * @author: 荣燊
 * @create: 2021-07-06 16:48
 **/
public class HJ55 {
    //  挑7
    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        while (scanner.hasNext()) {
//            int a = scanner.nextInt();
//            System.out.println(function1(a));
//        }
        System.out.println(function1(20));
    }

    public static int function1(int n) {
        int res = 0;
        for(int i=7; i<=n; i++) {
            if (i % 7 == 0) {
                res++;
                continue;
            } else {
                int j = i;
                while (j > 0) {
                    if (j % 10 == 7) {
                        res++;
                        break;
                    }
                    j /= 10;
                }
            }
        }
        return res;
    }
}
